<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <script src="http://code.jquery.com/jquery-2.1.1.min.js"></script>
    <title>在线OJ系统</title>
    <link rel="stylesheet" href="/css/index.css">
    <style>
        .container .content{/*.类选择器*/
            width: 100%;  /*宽度*/
            /* background-color: #ccc;  用来调试 */
            margin: 0px auto;  /*设置整体居中*/
            text-align: center;  /*设置盒子里的文字居中*/
            /* 设置上外边距*/
            margin-top: 100px;
        }
        .container  .content .font_{
            display: block;  /*设置标签为块级元素，独占一行，可以设置高度宽度等属性*/ 
            margin-top: 20px;  /*每个标签之间上间距像素点*/ 
            text-decoration: none;  /*去掉链接下划线*/ 
            --font-size: larger;  /*设置字体大小*/ 
        }
        .container .img{
            margin-top: 50px;
        }
    </style>
</head>
<body>
    <div class="container">
        <div class="navbar">
            <a href="/">首页</a>
            <a href="/all_questions">题库</a>
            <a href="#">讨论</a>
            <a href="/admin/questions" id="adminLink" style="display: none;">题目管理</a>
            <button id="loginBtn" class="login">登录</button>
        </div>

        <div class="content">
            <h1 class="font_">这里是林仔的个人在线OJ首页~</h1>
            <p class="font_">我们经历的每个日常也许就是连续不断的奇迹。 --《日常》</p>
            <a class="font_" href="/all_questions">点击这里开始编程之旅！</a>  <!--跳转网页-->
        </div>
        <div align="center" class="img">
            <img src="../images/index2.jpg" alt="index2.jpg" width="381" height="342">
        </div>
    </div>

    <div id="loginModal" class="modal">
        <div class="modal-content">
          <span class="close">&times;</span>
          <h2>登录</h2>
          <form id="loginForm">
            <input class="acc" type="text" id="username" name="username" placeholder="用户名">
            <div class="user_error">
                <pre></pre>
            </div>
            <input class="acc" type="password" id="password" name="password" placeholder="密码">
            <div class="password_error">
                <pre></pre>
            </div>
            <input class="btn" type="submit" value="登录">
            <p>没有账号？点击这里:</p>
            <button id="registerBtn">注册</button>
          </form>
        </div>
    </div>

    <div id="registerModal" class="modal">
        <div class="modal-content">
          <span class="close">&times;</span>
          <h2>注册</h2>
          <form id="registerFrom">
            <input class="acc" type="text" id="regUsername" name="regUsername" placeholder="用户名不为空">
            <div class="user_error">
                <pre></pre>
            </div>
            <input class="acc" type="password" id="regPassword" name="regPassword" placeholder="密码至少4位">
            <div class="password_error">
                <pre></pre>
            </div>
            <input class="btn" type="submit" value="注册">
          </form>
        </div>
    </div>

    
<!-- 在导航栏添加管理员入口 -->
<div class="navbar">
    <a href="/">首页</a>
    <a href="/all_questions">题库</a>
    <a href="#">讨论</a>
    <!-- 添加管理员入口 -->
    <a href="/admin/questions" id="adminLink" style="display: none;">题目管理</a>
    <button id="loginBtn" class="login">登录</button>
</div>


<!-- 添加管理员页面模板 -->
<div id="adminModal" class="modal">
    <div class="modal-content" style="width: 80%;">
        <span class="close">&times;</span>
        <h2>题目管理</h2>
        <button onclick="showAddQuestionForm()">添加新题</button>
        <div id="questionList"></div>
        
        <!-- 添加/编辑题目表单 -->
        <div id="editForm" style="display: none;">
            <form id="questionForm">
                <input type="hidden" id="questionNumber">
                <input class="acc" type="text" id="title" placeholder="题目标题">
                <input class="acc" type="text" id="star" placeholder="难度">
                <textarea class="acc" id="desc" placeholder="题目描述"></textarea>
                <textarea class="acc" id="header" placeholder="预设代码"></textarea>
                <textarea class="acc" id="tail" placeholder="测试代码"></textarea>
                <input class="acc" type="text" id="testInput" placeholder="测试输入">
                <input class="acc" type="number" id="cpuLimit" placeholder="CPU限制">
                <input class="acc" type="number" id="memLimit" placeholder="内存限制">
                <button class="btn" type="button" onclick="submitQuestionForm()">保存</button>
            </form>
        </div>
    </div>
</div>

    <!-- 个人信息弹窗 -->
    <div id="userProfileModal" class="modal">
        <div class="modal-content">
            <span class="close">&times;</span>
            <!-- 欢迎用户 -->
            <h2 id="welcomeMsg">welcome</h2>
            <div align="center" class="img">
                <img src="../images/index2.jpg" alt="index2.jpg" width="157" height="165">
            </div>
            <!-- 修改密码按钮 -->
            <button id="users" onclick="changePassword()">修改密码</button>
            <!-- 退出登录按钮 -->
            <button id="users" onclick="logout()">退出登录</button>
        </div>
    </div>

    <div id="changePasswordModal" class="modal">
        <div class="modal-content">
          <span class="close">&times;</span>
          <h2>修改密码</h2>
          <canvas id="captchaCanvas" width="300" height="20"></canvas>
          <form id="changePasswordFrom">
            <input class="acc" type="text" id="verCode" name="verCode" placeholder="输入四位验证码">
            <div class="verCode_error">
                <pre></pre>
            </div>
            <input class="acc" type="text" id="oldPassword" name="oldPassword" placeholder="旧的密码">
            <div class="oldPassword_error">
                <pre></pre>
            </div>
            <input class="acc" type="password" id="newPassword1" name="newPassword1" placeholder="新的密码,密码至少4位">
            <div class="newPassword_error">
                <pre></pre>
            </div>
            <input class="acc" type="password" id="newPassword2" name="newPassword2" placeholder="再次确认输入新密码">
            <div class="password_error">
                <pre></pre>
            </div>
            <input class="btn" type="submit" value="修改">
          </form>
        </div>
    </div>

    <script src="/js/login.js" type="text/javascript" charset="utf-8"></script>
    <script src="/js/login.js"></script> <!-- 让 JS 在 HTML 加载完后执行 -->
</body>
</html>
